import os from 'os'

function getIPAddress() {
    let interfaces = os.networkInterfaces();
    let ans;
    for (const devName in interfaces) {
        const iface = interfaces[devName];
        for (var i = 0; i < iface.length; i++) {
            var alias = iface[i];
            if (
                alias.family === "IPv4" &&
                alias.address !== "127.0.0.1" &&
                !alias.internal
            ) {
                ans = alias.address;
                break;
            }
        }
    }
    return ans;
}
const  ip =getIPAddress();

export {
    ip
}
